home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / OpenDoc 1.2b2c1 / TestParts / Clock / ClockPrt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-01-01  |  6.6 KB  |  221 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ClockPrt.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Owned by:    Richard Rodseth
  7.  
  8.     Copyright:    © 1995 - 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <3>      10/15/96    JP        1375124 : Used Active Part prop when
  13.                                     recording.
  14.          <2>     7/16/96    EL        1295068: Add dirty flag.
  15.         <13>    10/23/95    RR        #1291688 Added test for adding New menus
  16.         <12>     9/12/95    RR        Various activation problems. Added a
  17.                                     floating window
  18.         <11>     8/25/95    JP        1268279: Added frame to SendSetDataEvent
  19.         <10>     8/15/95    RR        HandleOSEvent takes Frame and Facet
  20.          <9>     7/10/95    RR        Misc. cleanup and bug fixes for shared
  21.                                     window
  22.          <8>     7/10/95    JP        Scripting cleanup
  23.          <7>      7/7/95    RR        Some refactoring. Fix
  24.                                     CreatePropObjSpecifier to deal with
  25.                                     non-persistent frame. Set source frame of
  26.                                     dialogs.
  27.          <6>     6/28/95    RR        1242642 BB Mostly ref counting
  28.          <5>     6/15/95    TJ        Added Includes for compiling with out PCH
  29.          <4>     6/13/95    JP        Recordable Clock
  30.          <3>      6/8/95    RR        #1257260 Collapse base classes. #1214898
  31.                                     StdTypes.r -> ODTypes.r
  32.          <2>      6/3/95    TJ        Added #includes for compile with out PCH
  33.          <1>     5/31/95    RR        first checked in
  34.  
  35.     To Do:
  36. */
  37.  
  38. #ifndef _CLOCKPRT_
  39. #define _CLOCKPRT_
  40.  
  41. #ifndef _WINUTILS_
  42. #include <WinUtils.h>
  43. #endif
  44.  
  45. #ifndef SOM_ODStorageUnitView_xh
  46. #include <SUView.xh>
  47. #endif
  48.  
  49. #ifndef _ORDCOLL_
  50. #include <OrdColl.h>
  51. #endif
  52.  
  53. #ifndef SOM_ODSession_xh
  54. #include <ODSessn.xh>
  55. #endif
  56.  
  57. #ifndef SOM_ODWindow_xh
  58. #include <Window.xh>
  59. #endif
  60.  
  61. #ifndef SOM_ODMenuBar_xh
  62. #include <MenuBar.xh>
  63. #endif
  64.  
  65. #ifndef SOM_ODShape_xh
  66. #include <Shape.xh>
  67. #endif
  68.  
  69. class ClockPart;
  70. class ClockSI;
  71. class ClockFrame;
  72.  
  73. //=========================================================================
  74. // Clock Part
  75. //=========================================================================
  76.  
  77. class ClockPart
  78. {
  79. public:
  80.     ClockPart();
  81.     virtual ~ClockPart();
  82.     void InitClockPart(Environment* ev,
  83.                            ODSession* session, 
  84.                         ODPart* somSelf, 
  85.                         ODPart* partWrapper);
  86.                         
  87.     void PrepareStorage(Environment* ev, ODStorageUnit* storageUnit);
  88.     void Release(Environment* ev);
  89.     void ReleaseAll(Environment* ev);
  90.     void Internalize(Environment* ev, ODStorageUnit* storageUnit);
  91.     void Externalize(Environment* ev);
  92.     void CloneInto(Environment *ev,
  93.                     ODDraftKey key,
  94.                     ODStorageUnit* storageUnit,
  95.                     ODFrame* scopeFrame);
  96.                     
  97.     ODTypeToken CheckPresentation(Environment* ev, ODFrame* frame);
  98.         // Makes sure the presentation is one of this part's known ones
  99.         
  100.     ClockFrame* CreateClockFrame(Environment* ev, ODFrame* frame, ODTypeToken presentation);
  101.         // Creates a ClockFrame or descendent to attach as the part info
  102.                     
  103.     void DisplayFrameAdded(Environment *ev, ODFrame* frame);
  104.     void DisplayFrameConnected(Environment *ev, ODFrame* frame);
  105.     void DisplayFrameRemoved(Environment *ev, ODFrame* frame);
  106.     void DisplayFrameClosed(Environment *ev, ODFrame* frame);
  107.     ODInfoType ReadPartInfo(Environment *ev,
  108.                                 ODFrame* frame, 
  109.                                 ODStorageUnitView*    storageUnitView);
  110.                                 
  111.     ODBoolean ContainsDisplayFrame(Environment* ev, ODFrame* frame);
  112.     void AddContentFrame(Environment* ev, ODFrame* frame);
  113.     void RemoveContentFrame(Environment* ev, ODFrame* frame);
  114.     
  115.     void BuildMenuBar(Environment* ev);
  116.     void InstallMenus(Environment* ev);
  117.     void OutlineSizeMenu(Environment *ev);
  118.     void HandleFontMenu(Environment *ev, ODUShort item, ODFrame* frame);
  119.     void HandleSizeMenu(Environment *ev, ODUShort item, ODFrame* frame);
  120.     void HandleStyleMenu(Environment *ev, ODUShort item, ODFrame* frame);
  121.     
  122.     void ShowAboutBox(Environment* ev, ODFrame* frame);
  123.     void ShowSynchDialog(Environment* ev);
  124.     void NewFloater(Environment* ev, ODFrame* frame);
  125.     void NewSinker(Environment* ev, ODFrame* frame);
  126.     
  127.     ODID OpenInitialWindow(Environment* ev);
  128.     ODID OpenRootFrame(Environment* ev, ODFrame* frame);
  129.     void GetDefaultWindowProperties(Environment* ev, WindowProperties* props, ODFrame* sourceFrame);
  130.     ODPlatformWindow CreatePlatformWindow(WindowProperties& props);
  131.     ODWindow*  CreateWindow(Environment *ev, WindowProperties& props, ODFrame* rootFrame);
  132.  
  133.     void CalcClockBounds(Rect& rect);
  134.     void Idle(Environment* ev, ODEventData* event) { };
  135.     void AdjustMenus(Environment* ev);
  136.     ODBoolean HandleMenuEvent(Environment* ev, ODEventData* event, ODFrame* frame);
  137.         
  138.     ODBoolean CloseWindow(Environment* ev, ODFrame* frame);
  139.     
  140.     ODMenuBar* GetMenuBar() { return fMenuBar; };
  141.     
  142.     ODSShort GetFont() { return fFont; }
  143.         
  144.     ODSShort GetSize() { return fSize; }
  145.         
  146.     ODUByte GetStyle() { return fStyle; }
  147.     
  148.     ODSession*     GetSession() { return fSession; }
  149.     
  150.     ClockSI* AquireSI(Environment* ev);
  151.     void CreatePropObjSpec(Environment* ev, DescType prop, AEDesc& objSpec);
  152.     void SendSetDataEvent(Environment* ev, AEDesc& objSpec, AEDesc& data, ODFrame* frame);
  153.     void SendClockModeEvent(Environment *ev, ODBoolean analog, ODFrame* frame);
  154.     ODFrame* GetFirstFrame();
  155.     
  156.     void SetFont(Environment *ev, ODSShort fontNum);
  157.     void SetFontSize(Environment *ev, ODSShort fontSize);
  158.     void SetFontStyle(Environment *ev, ODUByte fontStyle);
  159.     
  160.     ODSShort GetLastAscent() { return fLastAscent;};
  161.     void SetLastAscent(ODSShort ascent) { fLastAscent = ascent;};
  162.     
  163.     ODPart* GetPartWrapper() { return fPartWrapper; };
  164.     
  165.     ODBoolean AlarmEnabled() { return fAlarmEnabled; };
  166.     void ToggleAlarm() { fAlarmEnabled = !fAlarmEnabled; };
  167.  
  168.     ODBoolean IsAnalog() { return fAnalog; };
  169.     void SetAnalog(Environment* ev, ODBoolean analog);
  170.     
  171.     ODShape* CreateOvalShape(Environment* ev, ODFrame* frame, Rect& rect);
  172.     
  173.     void AdjustDisplayFrames(Environment* ev);
  174.     void AdjustDialogs(Environment* ev);
  175.     
  176.     ODBoolean HandleOSEvent(Environment* ev, ODEventData* event, ODFrame* frame, ODFacet* facet);
  177.     
  178. public:    // Tokenized strings
  179.  
  180.     ODTypeToken fFrameView;                
  181.     ODTypeToken fTimePresentation;                
  182.     ODTypeToken fDisplaySettingsPresentation;    
  183.     ODTypeToken fAlarmSettingsPresentation;    
  184.     ODTypeToken fSynchronizePresentation;        
  185.     ODTypeToken fDialogPresentation;    
  186.  
  187.         
  188. private: // With inline accessors
  189.     ODMenuBar*             fMenuBar;
  190.     ODSShort             fFont;                     // text font
  191.     ODSShort             fSize;                     // text size
  192.     ODUByte             fStyle;                 // text style
  193.     ODSShort             fLastAscent;             // font ascent
  194.     ODBoolean             fAlarmEnabled;
  195.     ODBoolean            fAnalog;
  196.     ODSession*             fSession;
  197.     ODBoolean            fDirty;
  198. private: 
  199.     ODPart*                fPartWrapper;
  200.     ODArbitrator*        fArbitrator;
  201.     ODDispatcher*        fDispatcher;
  202.     ODWindowState*        fWindowState;
  203.     ClockSI*            fSemanticInterface;
  204.  
  205.     ODPart*                fSOMSelf;
  206.     ODStorageUnit*         fTestClockSU;
  207.     OrderedCollection*     fContentFrames;
  208.  
  209.     WindowPtr            fWorkPort;
  210.     MenuHandle             fFontMenu;
  211.     MenuHandle             fSizeMenu;
  212.     MenuHandle             fStyleMenu;
  213.     MenuHandle             fSettingsMenu;
  214.     MenuHandle             fViewMenu;
  215.     MenuHandle            fExtraMenu;
  216.     MenuHandle            fExtraSubMenu;
  217.     ODTypeToken         fModalFocus;
  218. };
  219.  
  220. #endif // _CLOCKPRT_
  221.